package gui.toolbox;



import java.awt.BorderLayout;

import javax.swing.JFrame;

import model.listener.NodeListener;


public final class MainWindow extends JFrame{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private NodeList nodeList = new NodeList();
	private Statebar statebar = new Statebar();
	private CoordinateSelector selector = new CoordinateSelector();
	private Chart chart;
	//private BodyPaint body = new BodyPaint();
	
	public MainWindow(int maxUsers){
		super();
		chart = new Chart(maxUsers);
		BorderLayout layout = new BorderLayout();
		this.setLayout(layout);
		this.setTitle("KiBeam");
		this.add(selector,BorderLayout.PAGE_START);
		this.add(nodeList,BorderLayout.WEST);
		this.add(statebar,BorderLayout.PAGE_END);
		this.add(chart,BorderLayout.EAST);
		
		// add listeners
		nodeList.addListener(chart);
		selector.addCoordinateListener(chart);
		
		//this.add(body,BorderLayout.EAST);
		//this.setSize(600,600);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		//this.setContentPane(body);
		this.pack();
	}
	
	public void setState(String text){
		statebar.setText(text);
	}
	
	public NodeListener getChartDataListener(){
		return chart;
	}


}
